A digital image coming for example from a digital photographic apparatus consists of a set of N×M pixels, where N is the height of the image in pixels and M the width of the image. The image thus obtained is encoded before being stored in memory. The initial data, that is to say the information representing the pixels of the image, are organized in a bidirectional table accessible, for example, line by line.
It is known that the operations of encoding and decoding digital images require a relatively high memory capacity as well as a long processing time.
Moreover, the size of the data output by these operations may be relatively high, which has a direct impact on the capacity of the buffer or buffers necessary for storing these data.
This is because the role of the buffers is to store the data of variable length output by the encoding device with a view to their transportation over the communication bus, said bus having a fixed and limited transport capacity per clock cycle.
However, the cost of buffers is generally higher, the greater the storage capacity.
Moreover, It is known that, when a signal encoding technique (for example, the encoding of images) is implemented in practice, the problem of the difference in the rate of input of the data of the signal in the encoding device and the rate of output from the encoding device must be managed.
This is because, during the encoding of the signal, the input rate is constant whereas the rate of output from the encoding device is variable and, in general, is less than the input rate.
The variable output rate of the encoding device may cause the generation of a quantity of data that is too great with respect to the capabilities of processing of the system which follows the encoding device.
To avoid having too much encoded data to transport and to process by the processing device, a buffer memory of FIFO (“First In First Out”) type is commonly used at the output of the encoding device.
More particularly, the buffer memory has the role of storing the data of variable length coming from the encoding device for the purpose of transporting them to the processing device through a communication bus, the latter having a fixed and limited capacity of transport, per clock cycle.
Moreover, the size of the data coming from the encoding device may be relatively high, which has a direct impact on the capacity of the buffer memory necessary for the storage of those data.
However, the cost of the buffer memories is generally all the higher that the storage capacity is great.
Thus, it is recommended to have a buffer memory of as small a size as possible.
However, the smaller the size of the buffer memory, the greater the risk during the encoding of images of the buffer memory being full, which then causes the process to stop.
Given the above, it is therefore necessary to install a buffer memory of which the size is sufficient such that the chances of it being full during the lifetime of the apparatus integrating the encoding device are virtually zero. For example, if it is an encoding device installed in a digital apparatus, it must be ensured that the size of the buffer memory is such that the problem is never encountered during the term of use of that apparatus.
For this reason, it is known to use a buffer memory of relatively large size and of which a large part is never used.
For all of these reasons, many studies have been carried out over several years for the purpose of minimizing the impact of the encoding and decoding on the size of the data output by these operations and on the size of the encoded data and thus on the filling of the buffer memories.
Thus there is known for example, from the U.S. Pat. No. 6,741,651, a method of encoding an image in a video stream which consists of comparing the size of the encoded image with a predetermined threshold. If the threshold is exceeded, then the method makes provision for replacing this image with a code representing an image index.
However, this method has the drawback of effecting an encoding with loss, which is not always acceptable.
In addition, from U.S. Pat. No. 5,717,394, a method is known for producing data of length close to a predetermined value, so reducing the variation in the rate of output from the encoding device. To do this, a plurality of encoded items of data of variable lengths are combined for the purpose of creating data of predetermined lengths.
However, such data must nevertheless be held in memory in order to be combined, so necessitating memories of relatively large sizes.
Furthermore, the document entitled “An Algorithm for Lossless Smoothing of MPEG Video” by Simon S. Lam, Simon Chow, and David K. Y. Yau Applications, Technologies, Architectures, and Protocols for Computer Communication Proceedings from the conference entitled “Communications architectures, protocols and applications”, London, United Kingdom—Pages: 281-293, 1994, describes a method exploiting the specific model of variation of the MPEG data stream in order to define a rate avoiding an increase in use of the buffer memory. This method relies on knowing in advance the time at which the occupancy of the memory starts to increase.
However, these methods have the drawback not only of using buffer memories of which the size is relatively great without however ensuring avoidance of the size of the buffer memory being exceeded, but also, of having low flexibility with respect to a strong unexpected increase in the use of the buffer memory.
Furthermore, according to these methods, the large majority of the capacity of the buffer memory is never used.
It would consequently be advantageous to be able to regulate the level of occupancy of a buffer serving for storing encoded data, in particular whilst performing an encoding without loss.